package com.py.longtrans.util;


import com.py.longtrans.LongTrans;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Calendar;
import java.util.Date;
import java.util.Timer;

class TimeUtil {

    private static Logger logger = LoggerFactory.getLogger(TimeUtil.class);

    // 定时任务测试
    public static void main(String[] arg){
//    public static void TimeTaskTest(){
        TimeTask task = new TimeTask();
        MonthTask monthTask = new MonthTask();
        Calendar calendar= Calendar.getInstance();

        Date firstTime = calendar.getTime();
        //日传间隔：30s 后续可能要改
        long period = 1000 * 60;
        //月传间隔：1天 后续可能要改
        long monthPeriod = 1000 * 60 * 60 * 24;

        Timer timer = new Timer();
        Timer monthTimer = new Timer();
//        System.out.println("启动线程");
        logger.info("启动线程");
//        LongTrans.transFile();
        timer.schedule(task, firstTime, period); // 日传定时任务
        monthTimer.schedule(monthTask,firstTime,monthPeriod); // 月传定时任务
    }
}
